// eslint-disable-next-line
import { UserLayout, BasicLayout, RouteView, BlankLayout, PageView } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

export const asyncRouterMap = [

  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/welcome',
    children: [

      {
        path: '/welcome',
        name: 'welcome',
        component: () => import('@/views/dashboard/Welcome'),
        hidden: true,
        meta: { title: '欢迎页', keepAlive: false, icon: bxAnaalyse }
      },
      {
        path: '/product',
        name: 'product',
        component: RouteView,
        redirect: '/product/category',
        meta: { title: '商品管理', icon: 'profile', keepAlive: false, permission: ['product'] },
        children: [
          {
            path: '/product/category',
            name: 'productCategory',
            component: () => import('@/views/product/Category'),
            meta: { title: '类目', keepAlive: false, permission: ['productCategory'] }
          },
          {
            path: '/product/brand',
            name: 'productBrand',
            component: () => import('@/views/product/Brand'),
            meta: { title: '品牌', keepAlive: false, permission: ['productBrand'] }
          },
          {
            path: '/product/attribute',
            name: 'productAttribute',
            component: () => import('@/views/product/Attribute'),
            meta: { title: '属性', keepAlive: false, permission: ['productAttribute'] }
          },
          {
            path: '/product/spuAdd',
            name: 'productSpuAdd',
            component: () => import('@/views/product/SpuAdd'),
            meta: { title: '商品添加', keepAlive: false, permission: ['productSpuAdd'] }
          },
          {
            path: '/product/spuList',
            name: 'productSpuList',
            component: () => import('@/views/product/SpuList'),
            meta: { title: '商品', keepAlive: false, permission: ['productSpuList'] }
          }

        ]
      },
      {
        path: '/promotion',
        name: 'promotion',
        component: RouteView,
        redirect: '/promotion/coupon',
        meta: { title: '促销管理', icon: 'profile', keepAlive: false, permission: ['promotion'] },
        children: [
          {
            path: '/promotion/coupon',
            name: 'promotionCoupon',
            component: () => import('@/views/promotion/Coupon'),
            meta: { title: '优惠券', keepAlive: false, permission: ['promotionCoupon'] }
          }
        ]
      },

      {
        path: '/sys',
        name: 'sys',
        component: RouteView,
        redirect: '/sys/user',
        meta: { title: '系统管理', keepAlive: false, icon: 'profile', permission: ['sys'] },
        children: [
          {
            path: '/sys/user',
            name: 'SysUser',
            component: () => import('@/views/sys/SysUser'),
            meta: { title: '用户', keepAlive: false, permission: ['sysUser'] }
          },
          {
            path: '/sys/role',
            name: 'SysRole',
            component: () => import('@/views/sys/SysRole'),
            meta: { title: '角色', keepAlive: false, permission: ['sysRole'] }
          },
          {
            path: '/sys/resource',
            name: 'SysResource',
            component: () => import('@/views/sys/SysResource'),
            meta: { title: '资源', keepAlive: false, permission: ['sysResource'] }
          }

        ]
      }

    ]
  },
  {
    path: '*', redirect: '/404', hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      }
    ]
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }

]
